<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">
	<f:view contentType="text/html" locale="en">
		<h:head/>
		<h:body>
			<div class="wrap container">
				<ui:include src="/views/blocks/header.xhtml"/>
				<p:dataTable var="user" paginator="true" rows="10" value="#{userBean.getUsers()}">
					
					<p:column headerText="Full Name" width="150">
						<h:outputText value="#{user.fullName}"/>
					</p:column>
					
					<p:column headerText="Username" width="100">
						<h:outputText value="#{user.username}"/>
					</p:column>
					
					<p:column headerText="Email">
						<h:outputText value="#{user.email}"/>
					</p:column>
					
					<p:column headerText="Notes">
						<h:outputText value="#{user.notes}"/>
					</p:column>
					
					<p:column headerText="Is Active" width="100">
						<h:outputText value="#{user.active}"/>
					</p:column>
					
					<p:column headerText="Operations" width="220">
						<h:form>
							<h:button styleClass="btn btn-xs btn-info" value="Show" outcome="userinfo.xhtml">
								<f:param name="userId" value="#{user.id}"/>
							</h:button>
							<h:commandButton styleClass="btn btn-xs btn-success" style="margin-left: 5px;" value="Activate" action="#{userBean.activateUser(user.id)}" rendered="#{not user.active}"/>
							<h:commandButton styleClass="btn btn-xs btn-danger" style="margin-left: 5px;" value="Delete" action="#{userBean.killUser(user.id)}"/>
						</h:form>
					</p:column>
				</p:dataTable>
			</div>
		</h:body>
	</f:view>
</html>